home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / VCR / TAPE.CLS < prev    next >
Encoding:
Text File  |  1996-09-16  |  1.6 KB  |  55 lines

  1. VERSION 1.0 CLASS 
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "clsTape"
  6. Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}"
  7. Attribute VB_Creatable = False
  8. Attribute VB_TemplateDerived = False
  9. Attribute VB_PredeclaredId = False
  10. Attribute VB_Exposed = False
  11. Attribute VB_Customizable = False
  12. '**********************************************
  13. ' Class module for the VCR sample application
  14. ' Acts as the tape transport mechanism for the
  15. ' VCR and controls "playback" of the images
  16. '**********************************************
  17.  
  18. Option Explicit
  19.  
  20. Public Left As Integer      'Last location
  21. Public Forward As Boolean   'Tape direction
  22. Public Speed As Integer     'Tape speed
  23. '**********************************************
  24. ' Purpose:  Calculates the new coordinates for
  25. '           each animation step.
  26. ' Inputs:   Width: the width of the picture box
  27. '           where the animation is displayed
  28. '**********************************************
  29. Public Sub Animate(Width As Integer)
  30.     If Forward = True Then
  31.         ' moving forward - increment the current left
  32.         ' unless approaching the right edge
  33.         If Left < Width - 50 Then
  34.             Left = Left + 50
  35.         Else
  36.             Left = 0
  37.         End If
  38.     Else
  39.         ' moving forward - decrement the current left
  40.         ' unless approaching the left edge
  41.         If Left > 0 Then
  42.             Left = Left - 50
  43.         Else
  44.             Left = Width - 50
  45.         End If
  46.     End If
  47. End Sub
  48.  
  49. Private Sub Class_Initialize()
  50.     ' Initialize the class properties
  51.     Forward = True
  52.     Left = 0
  53.     Speed = 300
  54. End Sub
  55.